package com.wanmait.recruit.service.impl;

import com.github.pagehelper.PageInfo;
import com.wanmait.recruit.pojo.Resume;
import com.wanmait.recruit.service.ProjectExpService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import com.wanmait.recruit.pojo.ProjectExp;
import com.wanmait.recruit.mapper.ProjectExpMapper;
import org.springframework.transaction.annotation.Transactional;

@Service("projectExpService")
@Transactional(rollbackFor = Exception.class)
public class ProjectExpServiceImpl implements ProjectExpService {

    @Resource
    private ProjectExpMapper projectExpMapper;

    public int deleteByPrimaryKey(Integer id){
        return projectExpMapper.deleteByPrimaryKey(id);
    }

    public void insert(ProjectExp record){
        projectExpMapper.insert(record);
    }

    @Override
    public void delete(ProjectExp object) {

    }

    @Override
    public void update(ProjectExp object) {

    }

    @Override
    public PageInfo<ProjectExp> search(int pageNum, int pageSize) {
        return null;
    }

    public int insertSelective(ProjectExp record){
        return projectExpMapper.insertSelective(record);
    }

    public ProjectExp selectByPrimaryKey(Integer id){
        return projectExpMapper.selectByPrimaryKey(id);
    }

    public int updateByPrimaryKeySelective(ProjectExp record){
        return projectExpMapper.updateByPrimaryKeySelective(record);
    }

    public int updateByPrimaryKey(ProjectExp record){
        return projectExpMapper.updateByPrimaryKey(record);
    }

    @Override
    public ProjectExp findByResume(Resume resume) {
        return projectExpMapper.findByResumeId(resume.getId());
    }

    @Override
    public boolean findIsProjectExp(Integer resumeId) {
        ArrayList<ProjectExp> projectExps = projectExpMapper.selectByResumeId(resumeId);
        if (projectExps.size()==0){
            return false;
        }else {
            return true;
        }

    }

    @Override
    public ArrayList<ProjectExp> findProjectExp(Integer resumeId) {
        return projectExpMapper.selectByResumeId(resumeId);
    }

    @Override
    public void delProjectExp(Integer id) {
        projectExpMapper.updateById(id);
    }
}
